*Replication file for article in JEPP
*Lena Maria Schaffer 05.07.2022

*Data set and code to replicate tables and figures (3-6) within the following article:
*Lena Maria Schaffer and Resul Umit
*"Public Support for National vs. International Climate Change Obligations"
*Journal of European Public Policy.
****

****
ssc install estout, replace
ssc install coefplot, replace
ssc install blindschemes, replace

import delimited "03_data_survey.csv", numericcols(5 6 7 9 10 11 12 13 14 15 16) clear 

drop if nie_iv=="NA"
gen treatment=0
replace treatment=1 if nie_iv=="national"
replace treatment=2 if nie_iv=="international"

gen v_national=0
replace v_national=1 if treatment==1

gen v_international=0
replace v_international=1 if treatment==2

***
*Generate IVs and labelling 
gen urban=0 if urban_rural==2 | urban_rural==3
replace urban=1 if urban_rural==1

label variable v_national "National"
label variable v_international "International"
label variable age "Age"
label variable income "Income"
label variable leftright "Left-Right"
label variable female "Female"
label variable climate "Climate Worry"
label variable education "Education"
label variable polinterest "Political Interest"

****** labelling 
	
	capture drop varname	  
	gen varname=0 if treatment==0
	replace varname=1 if treatment==1
	replace varname=2 if treatment==2
	

	sort  varname


	#delimit;
	label define varlab1 0 "Control" 1 "National" 2 "International"; 
	
	
	#delimit cr
	label values varname varlab1
	
	
sum nie_support,detail


******
* create the table A1-Descriptive statistics
eststo: estpost tabstat nie_support nie_high age female education climate income polinterest leftright    ///
, statistics(count mean median sd min max) columns(statistics)

esttab using descriptives.tex, replace                                       ///
cells("count mean(fmt(2)) p50(fmt(2)) sd(fmt(2)) min(fmt(2)) max(fmt(2))") ///
noobs label nonumber title("Descriptive statistics")                                         
eststo clear


****************************** Testing Information effects (H1) **********

*** Generate Results Table 1 and full Table A2
eststo M1: quietly regress nie_support i.v_national i.v_international
estadd local hascon "No"
margins, atmeans over(varname)
eststo M2: quietly regress nie_support i.v_national i.v_international age education female income  polinterest climate leftright 
estadd local hascon "Yes"
margins, atmeans over(varname)
eststo M3: quietly reg nie_high i.v_national i.v_international
estadd local hascon "No"
margins, atmeans over(varname)
eststo M4: quietly regress nie_high i.v_national i.v_international age education female polinterest income climate leftright
estadd local hascon "Yes"
margins, atmeans over(varname)

*****************************
*Creates Table 1 in text (unformatted) and Table A2 (Information effects - OLS regressions—complete results) in Appendix
esttab M1 M2 M3 M4 using table1.tex, replace  t(2) b(2) scalars("rmse s.e. of estimate") compress nogaps ///
star(* 0.10 ** 0.05 *** 0.01) nobaselevels label booktabs ///
mgroups("Support / Oppose" "High / Low", pattern(1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))  



******************************Testing Differences in FRAMING (H2) **********

***** Now looking at Framing effects == different test logic: t_national-t_international = 0:
gen help=1 if v_national==0 & v_international==0
replace v_national=. if help==1
replace v_international=. if help==1


*** Creating Figure 3 (main text) and Table  A3 (Appendix)
eststo Target_high_low: reg nie_high i.v_international
margins, atmeans over(v_international)
margins, at(v_international=(0(1)1))
estadd local hascon "No"
eststo Target_high_low_control: reg nie_high i.v_international age education female polinterest income climate leftright 
estadd local hascon "Yes"
eststo Support_Target: reg nie_support i.v_international
estadd local hascon "No"
eststo Support_Target_control: reg nie_support i.v_international age education female polinterest income climate leftright 
estadd local hascon "Yes"

***EFFECTS
margins, atmeans over(v_international)

***Figure 3 (unformatted)
coefplot Support_Target Target_high_low, drop(_cons)xline(0) scheme(plotplain)
graph export Figure3.png, replace
graph save Figure3.gph, replace

****Table A3 Framing effects - OLS regressions—complete results 
esttab Support_Target Support_Target_control Target_high_low Target_high_low_control using tableA3.tex, replace  t(2) b(2) compress label nogaps ///
star(* 0.10 ** 0.05 *** 0.01) scalars("rmse s.e. of estimate") eqlabels(none) varlabels(,blist(cut1:_cons "{hline @width}{break}")) booktabs ///
mgroups("Oppose / Support" "High / Low", pattern(1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))  

**Appendix Tables A4-A6 with interactions
eststo M1: reg nie_support i.v_international c.age i.v_international#c.age  
eststo M2: reg nie_support i.v_international c.age i.v_international#c.age education female climate polinterest income 
eststo M5: reg nie_high i.v_international c.age i.v_international#c.age  
eststo M6: reg nie_high i.v_international c.age i.v_international#c.age education female climate polinterest income 
eststo M7: reg nie_support i.v_international c.leftright i.v_international#c.leftright
eststo M8: reg nie_support i.v_international c.leftright i.v_international#c.leftright education female climate polinterest income 
eststo M9: reg nie_high i.v_international c.leftright i.v_international#c.leftright
eststo M10: reg nie_high i.v_international c.leftright i.v_international#c.leftright education female climate polinterest income 
eststo M11: reg nie_support i.v_international c.climate i.v_international#c.climate
eststo M12: reg nie_support i.v_international c.climate i.v_international#c.climate education female leftright polinterest income 
eststo M13: reg nie_high i.v_international c.climate i.v_international#c.climate
eststo M14: reg nie_high i.v_international c.climate i.v_international#c.climate education female leftright polinterest income 
 
****Appendix Table A4: Models with interaction effects (left-right) 
*** Interaction with left-right (Table A4)
esttab M7 M8 M9 M10 using "tableA4.tex", replace  t(2) b(2) scalars("rmse s.e. of estimate") compress nogaps ///
star(* 0.10 ** 0.05 *** 0.01) nobaselevels label booktabs ///
mgroups("Oppose / Support" "High / Low", pattern(1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))  

******** Figure 4: Linear Prediction for a) support for the reduction target (upper panel) and b) evaluation whether the target is too high - too low (lower panel), according to treatment group and ideology (left-right placement). 

******* SUPPORT 
reg nie_support i.v_international c.leftright i.v_international#c.leftright
margins v_international, at(leftright=(0(1)9))
marginsplot, scheme(plotplain) xtitle("Left-Right Placement")  name(Support_LR, replace)  ylabel(3(0.2)4.4)  title("Do you support or oppose Switzerland's 50% reduction target?",size(med))

******* TARGET
reg nie_high i.v_international c.leftright i.v_international#c.leftright
margins v_international, at(leftright=(0(1)9))
marginsplot, scheme(plotplain) xtitle("Left-Right Placement")  name(Target_High_LR, replace)   ylabel(2(0.5)4)  title("Do you think Switzerland's 50% reduction target is too high or too low?",size(med))

**** combining graphs for Figure 4
graph combine Support_LR Target_High_LR, scheme(plotplain) col(1) 
graph export "Interaction_LR.pdf", replace
graph save "Interaction_LR.gph", replace


****Appendix Table A5: Models with interaction effects (climate concern) 
***Interaction with climate concern (Table A5)

esttab M11 M12 M13 M14 using "tableA5.tex", replace  t(2) b(2) scalars("rmse s.e. of estimate") compress nogaps ///
star(* 0.10 ** 0.05 *** 0.01) nobaselevels label booktabs ///
mgroups("Oppose / Support" "High / Low", pattern(1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))  

******** Figure 5: Linear Prediction for a) support for the reduction target (upper panel) and b) evaluation whether the target is too high - too low (lower panel), according to treatment group and climate concern.

***** SUPPORT
reg nie_support i.v_international c.climate i.v_international#c.climate
margins v_international, at(climate=(1(1)4))
estimates store climate
marginsplot, scheme(plotplain) xtitle("Climate concern")   ylabel(2(0.2)4.4) name(Support_Worry, replace)  title("Do you support or oppose Switzerland's 50% reduction target?", size(med))

******* TARGET
reg nie_high i.v_international c.climate i.v_international#c.climate
margins v_international, at(climate=(1(1)4))
marginsplot, scheme(plotplain) xtitle("Climate concern") name(Target_high_Worry, replace)    ylabel(1.6(0.2)3.6)  title("Do you think Switzerland's 50% reduction target is too high or too low?", size(med))

**** combining graphs for Figure 5
graph combine Support_Worry Target_high_Worry, scheme(plotplain) col(1) 
graph export "Interaction_Worry.pdf", replace
graph save "Interaction_Worry.gph", replace

****Appendix Table A6: Models with interaction effects (Age) 
*** Interaction with age (Table A6)
esttab M1 M2 M5 M6  using "tableA6.tex", replace  t(2) b(2) scalars("rmse s.e. of estimate") compress nogaps ///
star(* 0.10 ** 0.05 *** 0.01) nobaselevels label booktabs ///
mgroups("Oppose / Support" "High / Low", pattern(1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))  

******** Figure 6: Linear Prediction for a) support for the reduction target (upper panel) and b) evaluation whether the target is too high - too low (lower panel), according to treatment group and age.

***** SUPPORT
reg nie_support i.v_international c.age i.v_international#c.age 
margins v_international, at(age=(20(5)80))
estimates store international
marginsplot, scheme(plotplain) xtitle("Age")  xlabel(,angle(45)) name(Support_Age, replace)  ylabel(3.2(0.2)4.2)  title("Do you support or oppose Switzerland's 50% reduction target?",size(med))

******* TARGET
reg nie_high i.v_international c.age i.v_international#c.age 
margins v_international, at(age=(20(5)80))
estimates store international
marginsplot, scheme(plotplain) xtitle("Age")  xlabel(,angle(45))  ylabel(2.6(0.2)3.5) name(Target_High_Age, replace) title("Do you think Switzerland's 50% reduction target is too high or too low?",size(med))

**** combining graphs for Figure 5
graph combine Support_Age Target_High_Age, scheme(plotplain) col(1) 
graph export "Interaction_Age.pdf", replace
graph save "Interaction_Age.gph", replace






******************* END OF Figures and Tables from MAIN DOCUMENT. *********************************
***** ******** ROBUSTNESS / APPENDIX
***** START FROM ABOVE to use full sample on information effects:

import delimited "03_data_survey.csv", numericcols(5 6 7 9 10 11 12 13 14 15 16) clear 

drop if nie_iv=="NA"
gen treatment=0
replace treatment=1 if nie_iv=="national"
replace treatment=2 if nie_iv=="international"

gen v_national=0
replace v_national=1 if treatment==1

gen v_international=0
replace v_international=1 if treatment==2

***
*nie_support
*table 1  
gen urban=0 if urban_rural==2 | urban_rural==3
replace urban=1 if urban_rural==1

label variable v_national "National"
label variable v_international "International"
label variable age "Age"
label variable income "Income"
label variable leftright "Left-Right"
label variable female "Female"
label variable climate "Climate Worry"
label variable education "Education"
label variable polinterest "Political Interest" 

**** Table A8
****robustness: multilevel Model
eststo M1:  mixed nie_support i.v_national i.v_international, ||canton:
estadd local hascon "No"
eststo M2: mixed nie_support i.v_national i.v_international age education female income  polinterest climate leftright, ||canton:
estadd local hascon "Yes"
eststo M5: mixed nie_high i.v_national i.v_international, ||canton:
estadd local hascon "No"
eststo M6: mixed nie_high i.v_national i.v_international age education female polinterest income climate leftright, ||canton:
estadd local hascon "Yes"

esttab M1 M2 M5 M6 using "TableA8.tex", replace  t(2) b(2) compress label nogaps ///
nobaselevels  star(* 0.10 ** 0.05 *** 0.01) transform(ln*: exp(@) exp(@)) eqlabels("" "sd(canton)" "sd(_cons)" "sd(Residual)", none) varlabels(,elist(weight:_cons "{break}{hline@width}")) varwidth(13) booktabs mgroups("Support / Oppose" "High / Low", pattern(1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))  

*****Table A9
****ordered logistic
eststo M1:  ologit nie_support i.v_national i.v_international
estadd local hascon "No"
eststo M2: ologit nie_support i.v_national i.v_international age education i.female income  polinterest climate leftright
estadd local hascon "Yes"
eststo M5: ologit nie_high i.v_national i.v_international
estadd local hascon "No"
eststo M6: ologit nie_high i.v_national i.v_international age education i.female polinterest income climate leftright
estadd local hascon "Yes"

esttab M1 M2 M5 M6 using "TableA9.tex", replace  t(2) b(2) compress nogaps ///
star(* 0.10 ** 0.05 *** 0.01) eqlabels(none) varlabels(,blist(cut1:_cons "{hline @width}{break}")) label booktabs ///
mgroups("Support / Oppose" "High / Low", pattern(1 0 1 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))  



